package com.bruan.exception;

import java.lang.invoke.LambdaConversionException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class ExceptionTest {
    public static void main(String[] args) throws ParseException{
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime time = LocalDateTime.now();
        dtf.format(time);

//        String time2 = "2024-11-22 22:22";
//        LocalDateTime ldt2 = LocalDateTime.parse(time2,dtf);
//        System.out.println(ldt2);

        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date d = sdf.parse("202-11-11 10:24");
            System.out.println(d);
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }

    }
}
